using System;
using System.Linq;
using System.CodeDom.Compiler;
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls;

namespace UIDefinitionTutorial.SampleDefinition
{
	[GeneratedCode("Coded UITest Helpers", "1.0.0.0")]
	public partial class UISamplePage : BrowserWindow
	{	
		public UISamplePage()
		{
		}
		
		public UISamplePage(Uri pageUrl)
		{
			CopyFrom(BrowserWindow.Launch(pageUrl));
		}
		
		public UISamplePage(Process process)
		{
			CopyFrom(BrowserWindow.FromProcess(process));
		}   

		private UIHeader mHeader;
		private UIContent mContent;
		public UIHeader Header
		{
			get
			{
				if (mHeader == null)
				{					
					mHeader = new UIHeader(this);
				}
				return mHeader;
			}
		}
		public UIContent Content
		{
			get
			{
				if (mContent == null)
				{					
					mContent = new UIContent(this);
				}
				return mContent;
			}
		}
	}

	[GeneratedCode("Coded UITest Helpers", "1.0.0.0")]
	public class UIHeader : HtmlDiv
	{
		internal UIHeader(UITestControl searchLimitContainer, UITestControl targetControl) : this(searchLimitContainer)
		{
			CopyFrom(targetControl);
		}

		public UIHeader(UITestControl searchLimitContainer) :
			base(searchLimitContainer)
		{
			SearchProperties[HtmlDiv.PropertyNames.TagName] = "div";
			SearchProperties[HtmlDiv.PropertyNames.Id] = "header";
		}
		
		public void Reset()
		{
			mText = null;
		
		}
		private HtmlSpan mText;
		public HtmlSpan Text
		{
			get
			{
				if (mText == null)
				{					
					mText = new HtmlSpan(this);
				}
				return mText;
			}
		}
	}
	[GeneratedCode("Coded UITest Helpers", "1.0.0.0")]
	public class UIContent : HtmlDiv
	{
		internal UIContent(UITestControl searchLimitContainer, UITestControl targetControl) : this(searchLimitContainer)
		{
			CopyFrom(targetControl);
		}

		public UIContent(UITestControl searchLimitContainer) :
			base(searchLimitContainer)
		{
			SearchProperties[HtmlDiv.PropertyNames.TagName] = "div";
			SearchProperties[HtmlDiv.PropertyNames.Id] = "content";
		}
		
		public void Reset()
		{
			mTextBox = null;
			mInsert = null;
			mList = null;
		
		}
		private HtmlEdit mTextBox;
		private HtmlButton mInsert;
		private UIContent_List mList;
		public HtmlEdit TextBox
		{
			get
			{
				if (mTextBox == null)
				{					
					mTextBox = new HtmlEdit(this);
					mTextBox.SearchProperties[HtmlDiv.PropertyNames.Id] = "textbox";
				}
				return mTextBox;
			}
		}
		public HtmlButton Insert
		{
			get
			{
				if (mInsert == null)
				{					
					mInsert = new HtmlButton(this);
					mInsert.SearchProperties.Add(new PropertyExpression(HtmlDiv.PropertyNames.Class, "new", PropertyExpressionOperator.Contains));
				}
				return mInsert;
			}
		}
		public UIContent_List List
		{
			get
			{
				if (mList == null)
				{					
					mList = new UIContent_List(this);
				}
				return mList;
			}
		}
	}
	[GeneratedCode("Coded UITest Helpers", "1.0.0.0")]
	public class UIContent_List : HtmlCustom
	{
		internal UIContent_List(UITestControl searchLimitContainer, UITestControl targetControl) : this(searchLimitContainer)
		{
			CopyFrom(targetControl);
		}

		public UIContent_List(UITestControl searchLimitContainer) :
			base(searchLimitContainer)
		{
			SearchProperties[HtmlDiv.PropertyNames.TagName] = "ul";
			SearchProperties[HtmlDiv.PropertyNames.Id] = "list";
		}
		
		public void Reset()
		{
			mItems = null;
		
		}
		private HtmlCustom[] mItems;
		public HtmlCustom[] Items
		{
			get
			{

				if (mItems == null)
				{					
					var query = new HtmlCustom(this);
					var allMatches = query.FindMatchingControls().OfType<HtmlCustom>();
					mItems = allMatches.ToArray();
				}
				return mItems;
			}
		}
	}
}

